<script setup>
// 父子传值
defineProps({
  title: {
    type: String,
    required: true
  }
})
</script>

<template>
  <el-card class="page-container">
    <template #header>
      <div class="header">
        <span>{{ title }}</span>
        <div class="extra">
          <!-- <el-button type="primary">添加分类</el-button> -->
          <!-- 具名插槽定制右侧按钮 -->
          <slot name="extra"></slot>
        </div>
      </div>
    </template>
    <!-- 默认插槽定制内容 -->
    <slot></slot>
  </el-card>
</template>
<style lang="scss" scoped>
.page-container {
  min-height: 100%;
  box-sizing: border-box;
  .header {
    // 头部使用flex布局
    display: flex;
    // /* 均匀排列每个元素,首个元素放置于起点，末尾元素放置于终点 */
    justify-content: space-between;
    align-items: center;
  }
}
</style>
